Book-O-Rama Book Entry Results
"
."Please go back and try again.";
exit;
}
$db = mysql_connect('localhost', 'student', 'CS!CS!', 'books'); //procedural connect to (host, user, password, database)
if (!$db)
die('Could not connect to the database, error # ' . mysql_error());
else
echo 'the mysql_connect succeeded'."
";
$query = "insert into books.books values
('".$isbn."', '".$author."', '".$title."', '".$price."')";
$result = mysql_query($query, $db); //execute the SQL query - returned table is in variable $result
if ($result)
echo mysql_affected_rows." book inserted into database.";
else
echo "An error has occurred. The item was not added.";
mysql_close($db); //close the database connection - lets other users in
?>